/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.videoRenter.domain;

import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 *
 * @author Matt
 */
@Entity
public class RentalStock implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String title;
    private String barcode;
    private int quantOnHand;
    private int quantToSell;
    private int quantToRent;
    
    @OneToMany (cascade=CascadeType.REMOVE)
    private List<RentalHistory> rentalHistory;
    @OneToMany (cascade=CascadeType.REMOVE)
    private List<Booking> booking;

    @ManyToOne
    private Price price;
    @ManyToOne
    private Category category;
    @ManyToOne
    private Location location;
    @ManyToOne
    private Platform platform;
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getBarcode() {
        return barcode;
    }

    public void setBarcode(String barcode) {
        this.barcode = barcode;
    }

    public int getQuantOnHand() {
        return quantOnHand;
    }

    public void setQuantOnHand(int quantOnHand) {
        this.quantOnHand = quantOnHand;
    }

    public int getQuantToSell() {
        return quantToSell;
    }

    public void setQuantToSell(int quantToSell) {
        this.quantToSell = quantToSell;
    }

    public int getQuantToRent() {
        return quantToRent;
    }

    public void setQuantToRent(int quantToRent) {
        this.quantToRent = quantToRent;
    }

    public List<RentalHistory> getRentalHistory() {
        return rentalHistory;
    }

    public void setRentalHistory(List<RentalHistory> rentalHistory) {
        this.rentalHistory = rentalHistory;
    }

    public List<Booking> getBooking() {
        return booking;
    }

    public void setBooking(List<Booking> booking) {
        this.booking = booking;
    }

    public Price getPrice() {
        return price;
    }

    public void setPrice(Price price) {
        this.price = price;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public Location getLocation() {
        return location;
    }

    public void setLocation(Location location) {
        this.location = location;
    }

    public Platform getPlatform() {
        return platform;
    }

    public void setPlatform(Platform platform) {
        this.platform = platform;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RentalStock)) {
            return false;
        }
        RentalStock other = (RentalStock) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "za.ac.cput.videoRenter.domain.RentalStock[ id=" + id + " ]";
    }
    
}
